<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>列表</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        a {
            text-decoration: none;
        }

        a:hover {
            text-decoration: none;
        }

        ul,
        li {
            list-style-type: none;
        }

        html,
        body {
            width: 100%;
            height: 100%;
            font-family: Arial;
            background-color: #fcfcfc;
            font-size: 18px
        }

        *,
        *:after,
        *:before {
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
        }

        #wrap {
            height: 100%;
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
            -webkit-box-orient: vertical;
            -webkit-flex-flow: column;
            flex-flow: column;
        }

        #main {
            -webkit-box-flex: 1;
            -webkit-flex: 1;
            flex: 1;
            padding: 20px;
            overflow-x: hidden;
            overflow-y: scroll;
        }

        #header {
            background-color: #fe6263;
        }

        .pcc_header {
            width: 100%;
            /*height: 2.2rem;*/
            display: flex;
        }

        .pcc_header .pcc_return {
            width: 4rem;
            height: 2.2rem;
            background: url("../image/retun-icon.png")no-repeat;
            background-size: 0.6rem;
            background-position: 0.7rem center;
        }

        .pcc_header .pcc_title {
            width: 12rem;
            height: 2.2rem;
            line-height: 2.2rem;
            color: #ffffff;
            text-align: center;
            font-size: 0.96rem;
        }

        .pcc_header .pcc_shere {
            width: 4rem;
            height: 2.2rem;
            background: url("../image/Personal.png")no-repeat center;
            background-size: 0.8rem;
        }

        .pcc_header .pcc-list {
            width: 4rem;
            height: 2.2rem;
            background: url("../image/list-icon.png")no-repeat;
            background-size: 0.8rem;
            background-position: right 0.7rem center;
        }

        .pcc_xuanzhuan {
            transform: rotate(180deg);
            -ms-transform: rotate(180deg);
            -webkit-transform: rotate(180deg);
        }

        .pcc_parameter {
            width: 100%;
            height: 2.5rem;
            line-height: 2.5rem;
            color: #999999;
            font-size: 14px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            box-shadow: #e7e7e7 0 2px 10px 1px;
            border-radius: 5px;
            padding: 0 8px;
            margin-bottom: 1rem
        }

        .pcc_foot {
            width: auto;
            height: 3rem;
            background-color: #ffffff;
            color: #8a8a8a;
            display: flex;
            border-top: 1px solid #8a8a8a;
        }

        .pcc_foot>div {
            width: 25%;
            height: 3rem;
            text-align: center;
            line-height: 1rem;
            font-size: 0.7rem;
            padding-top: 0.2rem;
        }

        .pcc_foot>div>.pcc_we {
            width: 100%;
            height: 1.5rem;
            display: block;
            background-image: url("../image/weimg.png");
            background-repeat: no-repeat;
            background-size: 1.1rem;
            background-position: center;
        }

        .pcc_foot>div>.pcc_shouye {
            width: 100%;
            height: 1.5rem;
            display: block;
            background-image: url("../image/shouye.png");
            background-repeat: no-repeat;
            background-size: 1.1rem;
            background-position: center;
        }

        .pcc_foot>div>.pcc_taizhang {
            width: 100%;
            height: 1.5rem;
            display: block;
            background-image: url("../image/taizhangon.png");
            background-repeat: no-repeat;
            background-size: 1.1rem;
            background-position: center;
        }

        .pcc_foot>div>.pcc_zicha {
            width: 100%;
            height: 1.5rem;
            display: block;
            background-image: url("../image/zicha.png");
            background-repeat: no-repeat;
            background-size: 1.1rem;
            background-position: center;
        }

        .pcc_color {
            color: #fe6263;
        }
    </style>
</head>

<body>
    <div id="wrap">
        <div id="header">
            <div class="pcc_header" style="border-bottom:1px solid #ffffff">
                <a class="pcc_return" href="#" onclick="closeappend();"></a>
                <p class="pcc_title">启安云台账</p>
                <span style="width:4rem"></span>
            </div>
            <div class="pcc_header" style="width:70%;margin:auto;">
                <a class="pcc_return" href="#" onclick="prev();"></a>
                <p class="pcc_title" id="year"></p>
                <a class="pcc_return pcc_xuanzhuan" href="#" onclick="next();"></a>
            </div>
        </div>

        <div id="main">

        </div>
        <div class="pcc_foot">
            <div onclick="openpage('index');">
                <span class="pcc_shouye"></span> 首页
            </div>
            <div onclick="openpage('parameter');" class="pcc_color">
                <span class="pcc_taizhang"></span> 台账
            </div>
            <div href="#" onclick="openpage('check');">
                <span class="pcc_zicha"></span> 企业自查
            </div>
            <div href="#" onclick="openpage('we');">
                <span class="pcc_we"></span> 我的
            </div>
        </div>
    </div>

</body>
<script type="text/template" id="template">
    {{~it:value:index}}
    <div class="pcc_parameter" onclick="openpage('{{=value.url}}');">
        {{=value.title}}
    </div>
    {{~}}

</script>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/APICloud-rest.js"></script>
<script type="text/javascript" src="../script/SHA1.js"></script>
<script type="text/javascript" src="../script/doT.min.js"></script>
<script type="text/javascript">
    apiready = function() {
        var header = $api.byId('header');
        //适配iOS 7+，Android 4.4+状态栏
        $api.fixStatusBar(header);
        var param = api.pageParam.name; //接收pageParam传值
        // alert(param)
        getlist();

    };

    function getlist() {
        var client = new Resource("A6081574015393", "F2EDB6AF-B6F9-488D-074B-A40489B4477B");
        var Parameter = client.Factory("parameter");
        Parameter.query({
            "filter": {
                "where": {},
                "skip": 0,
                "limit": 15
            }
        }, function(ret, err) {
          if(ret){
            arr(ret)
          }else {
            api.alert({
                title: '提示',
                msg: '暂时没有数据',
            }, function(ret, err) {

            });
          }

        })
    }

    function openpage(url) {
        api.openWin({
            name: url,
            url: './' + url + '.html',
            pageParam: {
                name: 'test'
            }
        });
    };
    //关闭本窗口
    function closeappend() {
        api.closeWin();
    };
    var year = $api.byId('year');
    var titleyear = new Date().getFullYear();
    year.innerHTML = titleyear;

    function prev() {
        titleyear--;
        year.innerHTML = titleyear
    }

    function next() {
        titleyear++;
        year.innerHTML = titleyear
    };

    function arr(data_) {
        var main = $api.byId('main');
        // 1. 编译模板函数
        var tempFn = doT.template($api.byId('template').innerHTML);
        // 2. 多次使用模板函数
        var resultText = tempFn(data_);
        $api.html(main, resultText);
    }

    function funalert() {
        alert(123456)
    }
</script>

</html>
